{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfbase.css?v={$version}"/>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" style="padding-bottom:83px;border:0;">
<div class="layui-col-sm12">
<div class="layui-card pcf30">
<div style="width:100%;height:100%;max-width:600px;">
    <div class="layui-form-item">
        <label class="layui-form-label"><b style="color:red;">*</b> 账号</label>
        <div class="layui-input-block">
        <input name="user_name" value="" class="layui-input" type="text" lay-verType="tips" lay-verify="required" required>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><b style="color:red;">*</b> 登录密码</label>
        <div class="layui-input-block">
            <input name="password" type="password" class="layui-input" maxlength="20" lay-verType="tips" lay-verify="required" required/>
            输入大于6位且小于16位密码
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><b style="color:red;">*</b> 确认密码</label>
        <div class="layui-input-block">
         <input type="password" name="password2" id="password2" value="" autocomplete="off" class="layui-input" lay-verType="tips" lay-verify="required|check_password2" required>
         输入大于6位且小于16位密码
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input name="pen_name" value="" type="text" class="layui-input" maxlength="20"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机</label>
        <div class="layui-input-block">
            <input name="mobile" value="" type="text" class="layui-input" maxlength="20"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱</label>
        <div class="layui-input-block">
            <input name="email" value="" type="text" class="layui-input" maxlength="20"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男"/>
            <input type="radio" name="sex" value="女" title="女"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            {if ($admininfo.role_id < 0)}
            <input type="radio" lay-filter="type" name="role_id" value="-1" lay-filter="role_id" title="超级管理员" checked><br>
            {/if}
            {volist name="roleList" id="vo"}
            <input type="radio" lay-filter="type" name="role_id" value="{$vo.id}"  title="{$vo.name}" {if isset($vo['checked']) && $vo['checked']}checked=""{/if}><br>
            {/volist}
        </div>
    </div>
</div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
    <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
</div>
<div class="pcfclear"></div>
</div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
            form.on('submit(formSubmit)', function(data){
                layer.load(2);
                $.ajax({
                    type : 'post',
                    url : "{:url('/system.admin/add')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                parent.window.location.href = res.url;
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
                return false;
            })
    });
</script>
</body>
</html>